package com.luoqy.speedy.core.desktop.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.luoqy.speedy.data.MySql;
import com.luoqy.speedy.util.AllException;
import com.luoqy.speedy.util.Result;
import com.luoqy.speedy.util.aop.log.Log;

/**
 * 桌面管控控制器
 * @author luoqy
 * @date 2020年4月16日
 */
@RestController
@RequestMapping("/desktop")
public class DesktopController {
	/**
	 * @param parent
	 * @return 获取图标栏目列表
	 */
	@RequestMapping("/list")
	@Log({"获取图标栏目列表","根据传入的参数获取是顶级或者是二级菜单栏目"})
	public Result list(String parent){
		try {
			if(null==parent||"".equals(parent)){
				parent="0";
			}
			Object list=MySql.SELECT("select * from speedy_menu where name!='代码生成' and parent="+parent, "list", null);
			return Result.success("查询成功",list);
		} catch (Exception e) {
			// TODO: handle exception
			AllException.recordException(e);
			return Result.error("查询失败");
		}
	}
}
